package com.szpx.controller.ZRZController;

import com.szpx.entity.ZRZ.Jiaolian;
import com.szpx.service.JiaolianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/jiaolian")
public class JiaolianController {
    @Autowired
    private JiaolianService jiaolianService;

    @GetMapping("/{id}")
    public Jiaolian getById(@PathVariable Integer id) {
        return jiaolianService.getById(id);
    }

    @GetMapping("/all")
    public List<Jiaolian> getAll() {
        return jiaolianService.getAll();
    }

    @PostMapping("/create")
    public boolean save(@RequestBody Jiaolian jiaolian) {
        System.out.println("新增教练");
        return jiaolianService.save(jiaolian);
    }

    @PostMapping("/update")
    public boolean update(@RequestBody Jiaolian jiaolian) {
        return jiaolianService.update(jiaolian);
    }

    @PostMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        System.out.println("删除："+id);
        return jiaolianService.delete(id);
    }
}
